<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #xdd{
            display: inline-block;
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
    
</head>
<body>
    <div id="xdd"></div>
    <script>
        var xdd=document.getElementById("xdd")
        xdd.onclick=function () {
            window.setTimeout(()=>this.style.backgroundColor="yellow",2000)
        }
    </script>
</body>
</html>